package com.daervin.svc.common.constants;

import java.util.Arrays;

/**
 * 操作类型(0作废、1进货、2出货)
 *
 * @author daervin
 * @version 1.0.0
 * @since 1.0.0
 */
public enum StockOpTypeEnum {
    DEL(0, "作废"),
    IN(1, "进货"),
    OUT(2, "出货"),
    ;

    public int val;

    public String desc;

    StockOpTypeEnum(int val, String desc) {
        this.val = val;
        this.desc = desc;
    }

    public int getVal() {
        return val;
    }

    public String getDesc() {
        return desc;
    }

    public static StockOpTypeEnum valOf(Integer val) {
        return Arrays.stream(StockOpTypeEnum.values()).filter(k -> val != null && k.getVal() == val).findFirst().orElse(null);
    }
}
